﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BIS.Portal.Core.Base;
using BIS.Portal.Core.Global;
using BIS.Portal.Core.Entity;

namespace BIS.Portal.Modules.CMS.Adm
{
	public partial class AdminCmsCategoryControl_Settings : ControlSettingBase
	{
        #region Get data settings
	    public string GetPageAlias
	    {
            get { return GetControlSetting<string>(ModuleSettingNames.AdminCmsCategoryControl.AdminCmsCategory_SelectedAliasPage,PortalContext.LanguageAlias);}
	    }
        #endregion

		protected void Page_Load(object sender, EventArgs e)
		{
            LoadData();
		}


        private  void LoadData()
        {
            Dictionary<string, FullPageSiteEntity> pageSiteEnities = new Dictionary<string, FullPageSiteEntity>();
            PortalContext.GetPageList(0, ref pageSiteEnities, "", false);

            foreach (KeyValuePair<string, FullPageSiteEntity> fullPageSiteEnity in pageSiteEnities)
            {
                ddlPageAlias.Items.Add(new ListItem()
                                           {
                                               Text = fullPageSiteEnity.Key,
                                               Value = fullPageSiteEnity.Value.PageAlias
                                           }); 
            }
            ddlPageAlias.SelectedValue = GetPageAlias;

        }

        public override void SaveSettings(Dictionary<string, string> settings)
        {
            SetControlSettingForAllLanguages(ddlPageAlias.ID,
                                             ModuleSettingNames.AdminCmsCategoryControl.AdminCmsCategory_SelectedAliasPage,
                                             settings);
        }
	}
}